//
//  GKZYUniversityInfoCell.m
//  GKZYAid
//
//  Created by Tony Zhang on 16/3/14.
//  Copyright © 2016年 GKZYAid. All rights reserved.
//

#import "GKZYUniversityInfoCell.h"
#import "MyDefine.h"
#import "GKZYMajorBoyAndGirlRatioView.h"

@implementation GKZYUniversityInfoCell

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{

    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        
    }
    return self;
}

-(void)configureTheCellWithModel:(GKZYUniversityInfoModel *)model{

    UILabel *label = [[UILabel alloc]initWithFrame:CGRectMake(0, 0, KmainScreenBounds.size.width, 40)];
    label.text = @"    学校简介";
    label.layer.borderWidth = 0.5f;
    label.layer.borderColor = CustomGrayColor.CGColor;
    [self addSubview:label];
    UILabel *detailInfo = [[UILabel alloc]init];
    detailInfo.numberOfLines = 0;
    detailInfo.lineBreakMode = NSLineBreakByCharWrapping;
    detailInfo.font = [UIFont systemFontOfSize:14];
    detailInfo.text = model.sch_intro;
    self.explandBut = [[UIButton alloc]init];
    if (model.explainOrPick) {
        CGSize size = [detailInfo sizeThatFits:CGSizeMake(KmainScreenBounds.size.width-40, MAXFLOAT)];
        detailInfo.frame = CGRectMake(20, 30, KmainScreenBounds.size.width-40, size.height);
       self.explandBut.frame = CGRectMake(KmainScreenBounds.size.width*0.3, CGRectGetMaxY(detailInfo.frame)+10, KmainScreenBounds.size.width*0.4, 25);
        [self.explandBut setTitle:@"收起" forState:(UIControlStateNormal)];
    }else{
        
        detailInfo.frame = CGRectMake(20, 30, KmainScreenBounds.size.width -40, 60);
        self.explandBut.frame = CGRectMake(KmainScreenBounds.size.width*0.3, CGRectGetMaxY(detailInfo.frame)+10, KmainScreenBounds.size.width*0.4, 25);
        [self.explandBut setTitle:@"显示全文" forState:(UIControlStateNormal)];
    }
    [self.explandBut setTitleColor:[UIColor orangeColor] forState:(UIControlStateNormal)];
    self.explandBut.layer.cornerRadius = 5;
    self.explandBut.layer.borderWidth = 0.5f;
    self.explandBut.layer.borderColor = [[UIColor orangeColor]CGColor];
    [self addSubview:detailInfo];
    [self addSubview:self.explandBut];
    
    UILabel *label0 = [[UILabel alloc]initWithFrame:CGRectMake(0, CGRectGetMaxY(self.explandBut.frame)+15, KmainScreenBounds.size.width, 5)];
    label0.backgroundColor = CustomGrayColor;
    [self addSubview:label0];
    
    UILabel *label1= [[UILabel alloc]initWithFrame:CGRectMake(0, CGRectGetMaxY(self.explandBut.frame)+20, KmainScreenBounds.size.width, 50)];
    label1.layer.borderColor = CustomGrayColor.CGColor;
    label1.layer.borderWidth = 0.5f;
    label1.text = @"    男女生的比例";
    [self addSubview:label1];
    
    GKZYMajorBoyAndGirlRatioView *ratioView = [[GKZYMajorBoyAndGirlRatioView alloc]initWithFrame:CGRectMake(0, CGRectGetMaxY(label1.frame), KmainScreenBounds.size.width, 120)];
    NSDictionary *dict = @{@"female_ratio":model.female_ratio,@"male_ratio":model.male_ratio};
    [ratioView configureTheViewWithGender_info:dict];
    ratioView.backgroundColor = [UIColor whiteColor];
    [self addSubview:ratioView];
    
    self.frame = CGRectMake(0, 0,KmainScreenBoundsWidth , CGRectGetMaxY(ratioView.frame));
}




@end
